<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>188递归</title>
</head>

<body>
  <h1>188递归</h1>
  <script>
    /* setInterval(() => {
      console.log('setInterval')
    }, 1000); */

    // 通过递归，用setTimeout()实现setInterval()效果
    function print() {
      console.log('setTimeout')
      setTimeout(print, 1000)
    }
    print()
  </script>
</body>

</html>